//
//  LogUtil.swift
//  whale
//
//  Created by topnet on 2022/7/5.
//

import UIKit

struct LogUtil {
    static func log(_ i: Any?) {
        #if DEBUG
        print("\n---------\(Date().description)-----------\n")
        if i == nil {
            print("nil")
            return
        }
        let _json = (i as? JSON) ?? JSON(i!)
        if _json.error == nil {
            print(_json)
        }else {
            print(i!)
        }
        print("\n---------------------------------------------\n")
        #else
        
        #endif
    }
    
    static func logs(_ s: [Any?]) {
        #if DEBUG
        print("\n---------\(Date().description)-----------\n")
        
        s.forEach { i in
            if i == nil {
                print("nil")
            }else {
                let _json = (i as? JSON) ?? JSON(i!)
                if _json.error == nil {
                    print(_json)
                }else {
                    print(i!)
                }
            }
            print("\n")
        }
        print("\n---------------------------------------------\n")
        #else
        
        #endif
    }
    
}
